package com.tarena.test.sentinel;

import com.tarena.test.sentinel.spi.datasource.SentinelDatasource;

import java.util.Iterator;
import java.util.ServiceLoader;

public class SentinelRun {
    public static void main(String[] args) {
        ServiceLoader<SentinelDatasource> load = ServiceLoader.load(SentinelDatasource.class);
        Iterator<SentinelDatasource> iterator = load.iterator();
        //对这个加载的结果.做迭代循环可以执行代码
        while(iterator.hasNext()){
            SentinelDatasource implement = iterator.next();
            System.out.println("当前实现类的名字"+implement.getClass().getName());
            implement.loadRules("流控规则");
        }
    }
}
